package im.ok.back.controller;

import im.ok.back.common.ServerResponse;
import im.ok.back.service.IPasswordService;
import im.ok.back.vo.PasswordQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("password")
public class PasswordController {

    @Autowired
    private IPasswordService iPasswordService;

    @GetMapping("getPassword")
    public ServerResponse getPassword(PasswordQuery passwordQuery) {
        return iPasswordService.getRandomPassword(passwordQuery.getBase(), passwordQuery.getLength());
    }
}
